<%@page import="java.sql.ResultSet"%>
<%@page import="database.DBConnector"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.Calendar"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
    <head>
        <script type="text/javascript" src="ajax.js"></script>
    </head>
    <%
                Date date = new Date();
                final int THISYEAR = date.getYear() + 1900;
                DBConnector dbc = DBConnector.getDBC();
    %>
    <body>
        <div id="main">
            <jsp:include page="topBar.jsp"></jsp:include>
            <div id="all">
                <div id="content">
                    <form id="bold" action="" name="addProduct" method="post" >
                        <br><br>
                        <table>
                            <h1>Produkt Specifikation:</h1>
                            <tr>
                                <td>Varenummer:</td>
                                <td><input id="PID" type="text"  maxlength="50"/></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>Varens Navn:</td>
                                <td><input id="Pname" type="text" maxlength="50"/></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>Indkøbspris:</td>
                                <td><input id="purchasePrice" type="text" /></td>
                                <td>USD</td>
                            </tr>
                            <tr>
                                <td>Salgspris:</td>
                                <td><input id="salesPrice" type="text" disabled="true"/></td>
                                <td>DKK</td>
                            </tr>
                            <tr>
                                <td>Afdeling:</td>
                                <td><SELECT id="department" multiple="true" >
                                        <option> Udstøding </option>
                                    </SELECT></td>
                                <td><img alt="" onclick="/*LINK TIL ADDSIDE*/" src="../pictures/addButton.png" height="15px" width="15px"/>
                                </td>
                            </tr>
                            <tr>
                                <td>Sektion:</td>
                                <td><SELECT id="section" multiple="true"  >
                                        <option> Manifold </option>
                                        <option> Sidepipes </option>
                                    </SELECT></td>
                                <td><img alt="" onclick="/*LINK TIL ADDSIDE*/" src="../pictures/addButton.png" height="15px" width="15px"/></td>
                            </tr>
                            <tr>
                                <td>Producent:</td>
                                <td><SELECT id="brand" multiple="true"  >
                                        <option> FelPro </option>
                                        <option> Mr. Gaskit </option>
                                    </SELECT></td>
                                <td><img alt="" onclick="/*LINK TIL ADDSIDE*/" src="../pictures/addButton.png" height="15px" width="15px"/></td>
                            </tr>
                            <tr>
                                <td>Produkt Type:</td>
                                <td><SELECT id="productType" multiple="true"  >
                                        <option> Udstødnings Systemer </option>
                                        <option> Headers </option>
                                        <option> Mufflers </option>
                                    </SELECT></td>
                                <td><img alt="" onclick="/*LINK TIL ADDSIDE*/" src="../pictures/addButton.png" height="15px" width="15px"/></td>
                            </tr>
                            <tr>
                                <td>Specifikation:</td>
                                <td><table>
                                        <td> Navn:  <i><font size="1">(eks: Materiale)</font></i> </td>
                                        <td> Værdi: <i><font size="1">(eks: V8/V6/L6)</font></i> </td>
                                        <tr>
                                            <td> <SELECT id="SName"style="width: 170px;" multiple="True"  >
                                                    <option> Materiale </option>
                                                </SELECT></td>
                                            <td> <SELECT id="SValue" style="width: 170px;" multiple="true"  >
                                                    <option> Børstet stål </option>
                                                    <option> Råstfrit stål </option>
                                                    <option> Plastik </option>
                                                    <option> Aluminium</option>
                                                </SELECT> </td>
                                        </tr>
                                    </table></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td></td>
                                <td>Tilføj <img alt="" onclick="/*LINK TIL ADDSIDE*/" src="../pictures/addButton.png" height="15px" width="15px"/><br>
                                    Opret ny specifikation <img alt="" onclick="/*LINK TIL ADDSIDE*/" src="../pictures/addButton.png" height="15px" width="15px"/><br>
                                </td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>Tilføjede Specifikationer:</td>
                                <td><dir id="elements">
                                        Tilføjede elementer...
                                    </dir></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td><br><h2>Knyt biler til produktet</h2></td>
                            </tr>
                            <tr>
                                <td>Mærke:</td>
                                <td><SELECT id="makes" size="6" onchange="updateModelsByMake(this.value)" multiple="true">
                                        <%
                                                    ResultSet rs = dbc.doQuery("SELECT DISTINCT MakeID FROM Cars;");
                                                    while (rs.next()) {
                                                        out.println("<option>" + rs.getString(1) + "</option>");
                                                    }
                                        %>
                                    </SELECT></td>
                                <td><img alt="" onclick="location.href='addModel.jsp';" src="../pictures/addButton.png" height="15px" width="15px"/></td>
                            </tr>
                            <tr>
                                <td>Model:</td>
                                <td><div id="model">
                                        <select></select>
                                    </div></td>
                                <td><img alt="" onclick="location.href='addModel.jsp';" src="../pictures/addButton.png" height="15px" width="15px"/></td>
                            </tr>
                            <tr>
                                <td>Årgang</td>
                                <td>
                                    <div id="combinedMakeModel">
                                        <SELECT id="cars" style="width: 240px; height:100px;" multiple="true">
                                        </SELECT></div>
                                    <SELECT id="year"style="width: 100px; height:100px;" multiple="true">
                                        <%
                                                    for (int i = THISYEAR; i >= 1900; i--) {
                                                        out.println("<option>" + i + "</option>");
                                                    }
                                        %>
                                    </SELECT></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td></td>
                                <td>
                                    Knyt til produkt!
                                    <img alt="" onclick="/*LINK TIL ADDSIDE*/" src="../pictures/addButton.png" height="15px" width="15px"/><br>
                                </td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>Tilknyttede biler:</td>
                                <td><dir id="elements">
                                        Tilføjede biler...
                                    </dir></td>
                                <td></td>
                            </tr>
                            <%--
                            <tr>
                                <td>Undermodel:</td>
                                <td><SELECT id="submodel" multiple="true" onchange="" >
                                        <option> Alle </option>
                                        <option> GT </option>
                                        <option> GTS </option>
                                    </SELECT></td>
                                <td><img alt="" onclick="/*LINK TIL ADDSIDE*/" src="../pictures/addButton.png" height="15px" width="15px"/></td>
                            </tr> 
                            --%>
                            <tr>
                                <td><input type="submit" name="submit" style="width: 100px; text-align: center" value="Tilføj produkt"/></td>
                                <td></td>
                                <td></td>
                            </tr>
                        </table>
                    </form>
                </div>
                <jsp:include page="navigationBar.jsp"></jsp:include>
            </div>
        </div>
    </body>
</html>
